/**
 * 
 */
package com.optimus.model.mapped;

import java.io.Serializable;

/**
 * @author Optimus
 */
public class ProductBean implements Serializable
{

	private static final long serialVersionUID = 12L;
	private int id;
	private int categoryId;
	private int shoppingCartQuantity = 1;
	private double price;
	private String name;
	private String picturePath;
	private String description;

	public ProductBean()
	{

	}

	/**
	 * 
	 * @param name
	 *            - product name
	 * @param price
	 * @param picturePath
	 * @param catalogId
	 */
	public ProductBean(String name, double price, String picturePath, int catalogId,
			String description)
	{
		this.name = name;
		this.price = price;
		this.picturePath = picturePath;
		this.categoryId = catalogId;
		this.description = description;
	}

	/**
	 * 
	 * @param name
	 *            - product name
	 * @param id
	 *            - unique ID number
	 * @param price
	 * @param picturePath
	 * @param catalogId
	 */
	public ProductBean(int id, String name, double price, String picturePath, int catalogId,
			String description)
	{
		this.name = name;
		this.id = id;
		this.price = price;
		this.picturePath = picturePath;
		this.categoryId = catalogId;
		this.description = description;
	}

	/**
	 * @return the shoppingCartQuantity
	 */
	public int getShoppingCartQuantity()
	{
		return shoppingCartQuantity;
	}

	/**
	 * @param shoppingCartQuantity
	 *            the shoppingCartQuantity to set
	 */
	public void setShoppingCartQuantity(int shoppingCartQuantity)
	{
		this.shoppingCartQuantity = shoppingCartQuantity;
	}

	/**
	 * 
	 * @return product name
	 */
	public String getName()
	{
		return name;
	}

	/**
	 * 
	 * @param product
	 *            name
	 */
	public void setName(String name)
	{
		this.name = name;
	}

	/**
	 * 
	 * @return product ID
	 */
	public int getId()
	{
		return id;
	}

	/**
	 * 
	 * @param product
	 *            id (should be unique)
	 */
	public void setId(int id)
	{
		this.id = id;
	}

	/**
	 * 
	 * @return product price
	 */
	public double getPrice()
	{
		return price;
	}

	/**
	 * 
	 * @param product
	 *            price
	 */
	public void setPrice(double price)
	{
		this.price = price;
	}

	/**
	 * 
	 * @return product URL picture path as string
	 */
	public String getPicturePath()
	{
		return picturePath;
	}

	/**
	 * 
	 * @param product
	 *            picturePath
	 */
	public void setPicturePath(String picturePath)
	{
		this.picturePath = picturePath;
	}

	/**
	 * 
	 * @return product category ID
	 */
	public int getCategoryId()
	{
		return categoryId;
	}

	public void setCategoryId(int categoryId)
	{
		this.categoryId = categoryId;
	}

	/**
	 * @return the description
	 */
	public String getDescription()
	{
		return description;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description)
	{
		this.description = description;
	}

	public String getHttpRequest()
	{
		return new String("id=" + id + "&name=" + name + "&price=" + price + "&picturePath="
				+ picturePath + "&categoryId=" + categoryId + "&description=" + description
				+ "&shoppingCartQuantity=" + shoppingCartQuantity);
	}

	@Override
	public boolean equals(Object o)
	{
		return this.getId() == ((ProductBean) o).getId();
	}

	@Override
	public String toString()
	{
		return new String("Product ID: " + id + ", Product Name: " + name + "\nPrice: " + price
				+ ", Quantity: " + shoppingCartQuantity);
	}
	
	public String toHtmlString()
	{
		return new String("Product Catalog ID: " + id + "<br/>Product Name: " + name + "<br/>Price: $" + price
				+ "<br/>Quantity: " + shoppingCartQuantity);
	}

}
